package com.sgb.kjwl.view.ui.adapter.material;

import android.content.Context;
import android.widget.TextView;

import com.sgb.kjwl.BR;
import com.sgb.kjwl.R;
import com.sgb.kjwl.model.entity.ParamsEntity;
import com.sgb.kjwl.model.entity.user.SkuItemAttrEntity;
import com.swgk.core.recyclerview.adapter.BaseRecycleAdapter;
import com.swgk.core.recyclerview.adapter.ItemViewHolder;

import java.util.List;

public class GoodsSkuAdapter extends BaseRecycleAdapter<SkuItemAttrEntity> {
    private TextView value;

    public GoodsSkuAdapter(Context context, List<SkuItemAttrEntity> data) {
        super(context, R.layout.item_params_sku, data);
    }

    @Override
    public void convert(ItemViewHolder holder, SkuItemAttrEntity entity) {
        holder.setBinding(BR.viewModel, entity);
        value = holder.itemView.findViewById(R.id.value);
        String s = "";
        if (entity.getList() != null)
            for (int i = 0; i < entity.getList().size(); i++) {
                if (i == entity.getList().size() - 1) {
                    s = s + entity.getList().get(i).getValData();
                } else {
                    s = s + entity.getList().get(i).getValData() + "、";
                }
            }
        value.setText(s);
    }
}
